import Main from '@/views/Main.vue';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'Login - 登录'
    },
    component: resolve => { require(['@/views/login.vue'], resolve); }
};

export const page404 = {
    path: '/*',
    name: 'error-404',
    meta: {
        title: '404-页面不存在'
    },
    component: resolve => { require(['@/views/error-page/404.vue'], resolve); }
};

export const page403 = {
    path: '/403',
    meta: {
        title: '403-权限不足'
    },
    name: 'error-403',
    component: resolve => { require(['@//views/error-page/403.vue'], resolve); }
};

export const page500 = {
    path: '/500',
    meta: {
        title: '500-服务端错误'
    },
    name: 'error-500',
    component: resolve => { require(['@/views/error-page/500.vue'], resolve); }
};

export const preview = {
    path: '/preview',
    name: 'preview',
    component: resolve => { require(['@/views/form/article-publish/preview.vue'], resolve); }
};

export const locking = {
    path: '/locking',
    name: 'locking',
    component: resolve => { require(['@/views/main-components/lockscreen/components/locking-page.vue'], resolve); }
};

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    component: Main,
    children: [
        { path: 'home', title: {i18n: 'home'}, name: 'home_index', component: resolve => { require(['@/views/home/home.vue'], resolve); } },
        { path: 'ownspace', title: '个人中心', name: 'ownspace_index', component: resolve => { require(['@/views/own-space/own-space.vue'], resolve); } },
        { path: 'order/:order_id', title: '订单详情', name: 'order_info', component: resolve => { require(['@/views/advanced-router/component/order-info.vue'], resolve); } },  // 用于展示动态路由
        { path: 'shopping', title: '购物详情', name: 'shopping', component: resolve => { require(['@/views/advanced-router/component/shopping-info.vue'], resolve); } },  // 用于展示带参路由
        { path: 'message', title: '消息中心', name: 'message_index', component: resolve => { require(['@/views/message/message.vue'], resolve); } },
    ]
};

export const sprpluginRouter = [
	{
	    path: '/sprUuc',
	    name: 'sprUuc',
	    component: Main,
	    children: [
	        { path: 'uucUser', title: '帐号管理', name: 'uucUser', icon: 'link', component: resolve => { require(['@/sprplugin/uuc/uucUser.vue'], resolve); } },
	        { path: 'uucPrivilege', title: '权限管理', name: 'uucPrivilege', icon: 'link', component: resolve => { require(['@/sprplugin/uuc/uucPrivilege.vue'], resolve); } }, 
	        { path: 'uucMenu', title: '菜单管理', name: 'uucMenu', icon: 'link', component: resolve => { require(['@/sprplugin/uuc/uucMenu.vue'], resolve); } }, 
	        { path: 'uucRole', title: '角色管理', name: 'uucRole', icon: 'link', component: resolve => { require(['@/sprplugin/uuc/uucRole.vue'], resolve); } }, 
	        { path: 'uucRolePrivilege', title: '角色配置权限', name: 'uucRolePrivilege', icon: 'link', component: resolve => { require(['@/sprplugin/uuc/uucRolePrivilege.vue'], resolve); } }, 
	        { path: 'uucRoleUser', title: '帐号授权', name: 'uucRoleUser', icon: 'link', component: resolve => { require(['@/sprplugin/uuc/uucRoleUser.vue'], resolve); } }, 
	        { path: 'sprUucUrlPrivilege', title: '链接权限配置', name: 'sprUucUrlPrivilege', icon: 'link', component: resolve => { require(['@/sprplugin/uuc/sprUucUrlPrivilege.vue'], resolve); } }, 
	    ]
	}	
];

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
/*
export const appRouter = [
    {
        path: '/uuc',
        icon: 'ios-color-filter-outline',
        name: 'uuc',
        title: '用户权限管理',
        component: Main,
        children: [ 
            { path: 'user', title: '帐号管理', name: 'user', icon: 'link', component: resolve => { require(['@/sprplugin/uuc/uucUser.vue'], resolve); } },
           	{ path: 'privilege', title: '权限管理', name: 'privilege', icon: 'link', component: resolve => { require(['@/sprplugin/uuc/uucPrivilege.vue'], resolve); } }, 
           	{ path: 'menu', title: '菜单管理', name: 'menu', icon: 'link', component: resolve => { require(['@/sprplugin/uuc/uucMenu.vue'], resolve); } }, 
           	{ path: 'role', title: '角色管理', name: 'role', icon: 'link', component: resolve => { require(['@/sprplugin/uuc/uucRole.vue'], resolve); } }, 
           	{ path: 'rolePrivilege', title: '角色配置权限', name: 'rolePrivilege', icon: 'link', component: resolve => { require(['@/sprplugin/uuc/uucRolePrivilege.vue'], resolve); } }, 
            { path: 'roleUser', title: '帐号授权', name: 'roleUser', icon: 'link', component: resolve => { require(['@/sprplugin/uuc/uucRoleUser.vue'], resolve); } }, 
       ]  
    }, 
    {
        path: '/basedatamng',
        icon: 'ios-color-filter-outline',
        name: 'basedatamng',
        title: '基础数据管理',
        component: Main,
        children: [
            { path: 'meetmng', title: '会议室管理', name: 'meetmng', icon: 'link', component: resolve => { require(['@/sprappview/basedatamng/meetmng.vue'], resolve); } },
            { path: 'meetmng2', title: '会议室管理2', name: 'meetmng2', icon: 'link', component: resolve => { require(['@/sprappview/boardroom2/index.vue'], resolve); } },
       ]
    },
];
*/
//仅支持两层菜单
export let appRouter = [];  
/* for test
export let appRouter = [    {
        path: '/basedatamng',
        icon: 'ios-color-filter-outline',
        name: 'basedatamng',
        title: '基础数据管理',
        component: Main,
        children: [
            { path: 'meetmng', title: '会议室管理', name: 'meetmng', icon: 'link', component: resolve => { require(['@/sprappview/basedatamng/meetmng.vue'], resolve); } },
            { path: 'meetmng2', title: '会议室管理2', name: 'meetmng2', icon: 'link', component: resolve => { require(['@/sprappview/boardroom2/index.vue'], resolve); } },
       ]
   },
];
*/

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    otherRouter,
    ...sprpluginRouter,/*chensm add@20171224*/
    preview,
    locking,
    ...appRouter,
    page500,
    page403,
    page404,
    
];
